<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <head>
        <title>Insert title here</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>Hello, Bootstrap Table!</title>
        <meta charset="UTF-8">
        <title>Title</title>
        <script th:src="@{/js/jquery-3.2.1.min.js}"></script>
        <!-- 最新 Bootstrap4 核心 CSS 文件 -->
        <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
        <!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
        <script	th:src="@{/js/bootstrap.bundle.min.js} " rel="stylesheet"></script>
        <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
        <script	th:src="@{/js/bootstrap.min.js}"rel="stylesheet"> </script>
        <!-- BootStrapValidator -->
        <link rel="stylesheet" href="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/css/bootstrapValidator.min.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.min.js"></script>
        <script th:src="@{/js/functions.js}"></script>

    </head>
</head>
<body>
<div th:include="../templates/admin/top::headtop"></div>
<div class="container" id="content">
    <div class="row">
        <div th:include="../templates/admin/menu::headmenu"></div>
        <div class="col-md-10">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <h1 class="col-md-5">电影订单</h1>
                        <form class="form-inline" id="searchForm" role="form" th:action="@{/order/findMOrder}" th:method="post">
                            <div class="form-group col-md-4 offset-1">
                                <input class="form-control input-sm" id="sorder_id" name="sorder_id" placeholder="订单编号" th:value="${param.sorder_id}"
                                       type="text"/>
                            </div>
                            <div class="form-group col-md-1">
                                <button class="btn btn-primary btn-sm" type="submit">搜索</button>
                            </div>
                        </form>
                    </div>
                </div>
                <table class="table table-bordered">
                    <thead>
                    <tr>
                    <tr>
                        <th>选项</th>
                        <th><a>#</a></th>
                        <th>电影名</th>
                        <th>放映厅</th>
                        <th>座位号</th>
                        <th>开始时间</th>
                        <th>购买者</th>
                        <th>票价</th>
                        <th>操作</th>
                    </tr>

                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="u,stat:${moiveList}">
                        <td><input name="chk" th:value="${u.forder_id}" type="checkbox"/></td>
                        <td th:text="${u.forder_id}"></td>
                        <td th:text="${u.film_name}"></td>
                        <td th:text="${u.screens_id}">号厅</td>
                        <td th:text="${u.seat}"></td>
                        <td th:text="${u.starttime}"></td>
                        <td th:text="${u.real_name}"></td>
                        <td th:text="${u.show_price}"></td>
                        <td>
                            <button class="btn btn-default btn-xs btn-danger btn-primary" th:onclick="deleteorder()">删除</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

        </div>
    </div>
</div>

</div>
<div class="modal fade" id="film_Intro" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <td><textarea name="film_Intro" rows="5" cols="20" class="form-control"></textarea></td>
</div>
<script type="text/javascript">
    function deleteorder() {
        var str = [];
        var sel = document.getElementsByName("chk");//获取checkbox的值
        console.log(sel)
        for (var i = 0; i < sel.length; i++)
            if (sel[i].checked == true)
                str.push(sel[i].value);
        if (str == "") {
            alert("请至少选择一条记录");
            return false;
        }


        // if(window.confirm("确定删除吗")){
        //     window.location="./DeleteUser?userids="+str;
        // }

        if (window.confirm("确定删除吗")) {
            $.post(getContextPath()+"/order/deleteMOrder", {forder_id: str.join(",")}, function (data) {
                window.location.reload();
            });
        }
    }




</script>

</body>
</html>